package com.konne.nightmare.FastPublicOpinion.ui.information.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.konne.nightmare.FastPublicOpinion.R;
import com.konne.nightmare.FastPublicOpinion.utils.DeviceUtil;

import java.util.List;

/**
 * @Author: chen
 * @UpdateDate: 1/27/22
 * @UpdateRemark:
 */
public class ClassMoveAdapter extends BaseQuickAdapter<String, BaseViewHolder> {


    public ClassMoveAdapter(int layoutResId, @Nullable List<String> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        TextView tvBigNum = (TextView) helper.getView(R.id.tv_big_num);
        TextView tvNum = (TextView) helper.getView(R.id.tv_num);
        ImageView imgArrow = (ImageView) helper.getView(R.id.img_arrow);
        CheckBox imgSelect = (CheckBox) helper.getView(R.id.img_select);
        LinearLayout llContent = (LinearLayout) helper.getView(R.id.ll_content);


        tvBigNum.setText(String.valueOf(helper.getLayoutPosition()+1));
        for (int i= 0;i<3;i++){
            LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                    LinearLayout.LayoutParams.MATCH_PARENT, DeviceUtil.dip2px(mContext, 50));
            View view = LayoutInflater.from(mContext).inflate(R.layout.item_move_class_content, null);
            view.setLayoutParams(lp);
            llContent.addView(view);
        }

        imgArrow.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (llContent.getVisibility() == View.VISIBLE){
                    llContent.setVisibility(View.GONE);
                    imgArrow.setImageResource(R.mipmap.icon_blue_arrow_down);
                }else {
                    llContent.setVisibility(View.VISIBLE);
                    imgArrow.setImageResource(R.mipmap.icon_blue_arrow_up);
                }
            }
        });
        imgSelect.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
    }
}
